#include "PointerCopyTest.h"
#include <iostream>
#include <string>

PointerCopyTest::PointerCopyTest()
{

}

PointerCopyTest::~PointerCopyTest()
{
    if(this->m_pObjSerialNum)
    {
        std::cout<<"destructor has being called\n";
        delete m_pObjSerialNum;
        m_pObjSerialNum = NULL;
    }
}
/**
  *@brief 浅拷贝
*/
PointerCopyTest::PointerCopyTest(const PointerCopyTest &other)
{
    this->m_pObjSerialNum = other.m_pObjSerialNum;
}

void PointerCopyTest::setPointer(int *pInt)
{
    this->m_pObjSerialNum = pInt;
}

void PointerCopyTest::checkPointer()
{
    if(this->m_pObjSerialNum)
    {
        std::cout<<"pointer still exists"<<std::endl;
        std::cout<<*this->m_pObjSerialNum<<std::endl;
    }
}
